function fig1_clear
    %FIG1_CLEAR Summary of this function goes here
    %   Detailed explanation goes here
    global f1;
    global S_Map;
    global D_Map;
    global scene_size;
    global nodes_count;
    global fig1_draw_surf;

    [va,ve] = view;
    
    figure(f1);
    
    % clear figure
    hold off;
    newplot;
    hold on;
    
    axis([0 scene_size 0 scene_size 0 300 0 300]);
    
    % create initial content
    X(1,1:nodes_count)=S_Map(1:nodes_count,1);
    Y(1,1:nodes_count)=S_Map(1:nodes_count,2);
    
    if (fig1_draw_surf)
        Z(1,1:nodes_count)=diag(D_Map(1:nodes_count,1:nodes_count)); % surface visualising distance between BS and each node
        % Z(1,:)=S_Map(:,3);         % surface visualising instant energy value in each node
        gx=0:1:scene_size;
        gy=0:1:scene_size;

        colorbar EastOutside;      % color scale bar on rigth side, outside figure
        g=gridfit(X,Y,Z,gx,gy);

        surf(gx,gy,g);             % wykres powierzchni 3D (X,Y,Z)

        lighting phong;             % model o�wietleniainne opcje: flat, gouraud, none
        shading interp;             % cieniowanieinne opcje: flat,faceted  , interp
        light('Position',[-50 -50 120]);

        % plot nodes on surface
        plot3(X,Y,Z,'white.');
    end
    % plot nodes energy
    Z(1,1:nodes_count) = S_Map(1:nodes_count,3);
    plot3(X,Y,Z,'black.');
    
    % set current view
    view (va,ve);

end

